package com.googlecode.spoluyan.google.common;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import com.google.gson.TypeAdapter;

public class Defines {
    public static final String CLIENT_VERSION = "1.0";
    public static final String ENCODING = "UTF-8";
    public static final String TIMEZONE = "UTC";

    public static final String QUESTION_MARK = "?";
    public static final String EQUALS_SIGN = "=";
    public static final String AMPERSAND = "&";
    public static final String API_KEY_PARAM = "key";
    public static final String SLASH = "/";
    public static final String PLUS = "+";
    public static final String COLON = ":";
    public static final String EMPTY_STRING = "";

    public static final Map<Class<?>, TypeAdapter<?>> customJSONAdapters = new HashMap<Class<?>, TypeAdapter<?>>() {
	private static final long serialVersionUID = 5475114903606747323L;

	{
	    put(Date.class, new DateTypeAdapter());
	}
    };

    public static enum ClientName {
	GOOGLE_PLUS("google-plus"), GOOGLE_FEED("google-feed"), GOOGLE_APIS_DISCOVERY("google-apis-discovery");

	private String name;

	ClientName(String name) {
	    this.name = name;
	}

	public String getName() {
	    return name;
	}
    }

    public static class GooglePlusDefines {
	public static final String API_URL = "https://www.googleapis.com/plus/v1/";

	public static class Path {
	    public static final String PEOPLE = "people";
	    public static final String ACTIVITIES = "activities";
	    public static final String COMMENTS = "comments";
	}

	public static class Parameter {
	    public static final String QUERY = "query";
	    public static final String LANGUAGE = "language";
	    public static final String MAX_RESULTS = "maxResults";
	    public static final String PAGE_TOKEN = "pageToken";
	    public static final String ORDER_BY = "orderBy";
	    public static final String SORT_ORDER = "sortOrder";
	}

	public static enum PersonCollection {
	    PLUSONERS("plusoners"), RESHARERS("resharers");

	    private String name;

	    PersonCollection(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}

	public static enum ActivityCollection {
	    PUBLIC("public");

	    private String name;

	    ActivityCollection(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}

	public static enum OrderBy {
	    BEST("best"), RECENT("recent");

	    private String name;

	    OrderBy(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}

	public static enum SortOrder {
	    ASC("ascending"), DESC("descending");

	    private String name;

	    SortOrder(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}
    }

    public static class GoogleFeedDefines {
	public static final String API_URL = "https://ajax.googleapis.com/ajax/services/feed/";
	public static final String VERSION_VALUE = "1.0";

	public static class Path {
	    public static final String FIND = "find";
	    public static final String LOAD = "load";
	}

	public static class Parameter {
	    public static final String QUERY = "q";
	    public static final String VERSION = "v";
	}
    }

    public static class GoogleAPIsDiscoveryDefines {
	public static final String API_URL = "https://www.googleapis.com/discovery/v1/apis";

	public static class Path {
	    public static final String REST = "rest";
	}

	public static class Parameter {
	    public static final String LABEL = "label";
	    public static final String NAME = "name";
	    public static final String PREFFERED = "preferred";
	}

	public static enum Label {
	    LIMITED_AVAILABILITY("limited_availability"), DEPRECATED("deprecated");

	    private String name;

	    Label(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}
    }

    public static class GoogleBloggerDataDefines {
	public static final String API_URL = "https://www.googleapis.com/blogger/v2/";

	public static class Path {
	    public static final String BLOGS = "blogs";
	    public static final String USERS = "users/";
	    public static final String POSTS = "posts";
	    public static final String COMMENTS = "comments";
	    public static final String PAGES = "pages";
	}
    }

    public static class GoogleBooksDefines {
	public static final String API_URL = "https://www.googleapis.com/books/v1/";

	public static class Path {
	    public static final String VOLUMES = "volumes";
	    public static final String USERS = "users/";
	    public static final String BOOKSHELVES = "bookshelves";
	    public static final String MY_LIBRARY = "mylibrary/";
	    public static final String ADD_VOLUME = "addVolume";
	    public static final String REMOVE_VOLUME = "removeVolume";
	    public static final String CLEAR_VOLUMES = "clearVolumes";
	}

	public static class Parameter {
	    public static final String QUERY = "q";
	    public static final String DOWNLOAD = "download";
	    public static final String FILTER = "filter";
	    public static final String START_INDEX = "startIndex";
	    public static final String MAX_RESULTS = "maxResults";
	    public static final String PRINT_TYPE = "printType";
	    public static final String ORDER_BY = "orderBy";
	    public static final String VOLUME_ID = "volumeId";
	}

	public static enum AdditionalParameter {
	    IN_TITLE("intitle"), IN_AUTHOR("inauthor"), IN_PUBLISHER("inpublisher"), SUBJECT("subject"), ISBN("isbn"), LCCN(
		    "lccn"), OCLC("oclc");

	    private String name;

	    AdditionalParameter(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}

	public static enum Filter {
	    PARTIAL("partial"), FULL("full"), FREE_EBOOKS("free-ebooks"), PAID_EBOOKS("paid-ebooks"), EBOOKS("ebooks");

	    private String name;

	    Filter(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}

	public static enum PrintType {
	    ALL("all"), BOOKS("books"), MAGAZINES("magazines");

	    private String name;

	    PrintType(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}

	public static enum OrderBy {
	    RELEVANCE("relevance"), NEWEST("newest");

	    private String name;

	    OrderBy(String name) {
		this.name = name;
	    }

	    public String getName() {
		return name;
	    }
	}
    }
}
